//皮肤显示
var skinPath = "/tnweb/image/user_player_skin/default.png"
function init(skinPathVal) {
    //场景
    var scene = new THREE.Scene();
    //摄像机
    var camera = new THREE.PerspectiveCamera(45, 400 / 450, 0.1, 900);
    //渲染器
    var randerer = new THREE.WebGLRenderer({antialias: true,alpha: true});
    randerer.shadowMap.enabled = true;
    randerer.shadowMap.type = THREE.PCFSoftShadowMap;
    //渲染器初始颜色
    randerer.setClearColor(new THREE.Color(0xEEEEEE));
    //设置canvas画面大小
    randerer.setSize(400, 450);
    //显示三维坐标系
    var axes = new THREE.AxesHelper(20);
    //添加三维坐标系到场景中
    // scene.add(axes);


    var light = new THREE.SpotLight(0xffffff, 1);
    light.position.set(-25, 70, 25)
    light.castShadow = true;
    scene.add(light);
    //环境光
    var environmentLight = new THREE.AmbientLight(0xffc0cb, 0.8);
    environmentLight.position.set(0, -100, 0);
    scene.add(environmentLight);
    //Set up shadow properties for the light
    /* light.shadow.mapSize.width = 512; // default
     light.shadow.mapSize.height = 512; // default
     light.shadow.camera.near = 0.5; // default
     light.shadow.camera.far = 500; // default*/

    var texture = new THREE.TextureLoader().load(skinPathVal);
    texture.magFilter = THREE.NearestFilter;
    var material = new THREE.MeshPhongMaterial({map: texture, transparent: true, depthTest: false})


    //创建地面的几何体
    var planeGeometry = new THREE.PlaneGeometry(100, 100);
    //给地面上色
    var floorTexture = new THREE.TextureLoader().load("/tnweb/images/skin_info_floor.png");
    var planeMaterial = new THREE.MeshLambertMaterial({map: floorTexture});
    //创建地面
    var plane = new THREE.Mesh(planeGeometry, planeMaterial);
    //物体移动位置
    plane.rotation.x = -0.5 * Math.PI;
    plane.position.x = 15;
    plane.position.y = 0;
    plane.position.z = 0;
    //将地面添加到场景中
    plane.castShadow = true;
    plane.receiveShadow = true;
    scene.add(plane);
    /*/!*var helper = new THREE.CameraHelper( light.shadow.camera );*!/
    scene.add(helper);*/
    //定位相机,并且指向场景中心
    camera.position.x = 40;
    camera.position.y = 40;
    camera.position.z = 40;
    camera.lookAt(0, 20, 0);


    var head = new THREE.BoxGeometry(8, 8, 8);
    var headTop = [
        new THREE.Vector2(0.125, 0.875),
        new THREE.Vector2(0.25, 0.875),
        new THREE.Vector2(0.25, 1),
        new THREE.Vector2(0.125, 1)
    ];
    var headBottom = [
        new THREE.Vector2(0.25, 0.875),
        new THREE.Vector2(0.375, 0.875),
        new THREE.Vector2(0.375, 1),
        new THREE.Vector2(0.25, 1)
    ];
    var headLeft = [
        new THREE.Vector2(0, 0.75),
        new THREE.Vector2(0.125, 0.75),
        new THREE.Vector2(0.125, 0.875),
        new THREE.Vector2(0, 0.875)
    ];
    var headFront = [
        new THREE.Vector2(0.125, 0.75),
        new THREE.Vector2(0.25, 0.75),
        new THREE.Vector2(0.25, 0.875),
        new THREE.Vector2(0.125, 0.875)
    ];
    var headRight = [
        new THREE.Vector2(0.25, 0.75),
        new THREE.Vector2(0.375, 0.75),
        new THREE.Vector2(0.375, 0.875),
        new THREE.Vector2(0.25, 0.875)
    ];
    var headBack = [
        new THREE.Vector2(0.375, 0.75),
        new THREE.Vector2(0.5, 0.75),
        new THREE.Vector2(0.5, 0.875),
        new THREE.Vector2(0.375, 0.875)
    ];
    head.faceVertexUvs[0] = [];
    head.faceVertexUvs[0][0] = [headRight[3], headRight[0], headRight[2]];
    head.faceVertexUvs[0][1] = [headRight[0], headRight[1], headRight[2]];
    head.faceVertexUvs[0][2] = [headLeft[3], headLeft[0], headLeft[2]];
    head.faceVertexUvs[0][3] = [headLeft[0], headLeft[1], headLeft[2]];
    head.faceVertexUvs[0][4] = [headTop[3], headTop[0], headTop[2]];
    head.faceVertexUvs[0][5] = [headTop[0], headTop[1], headTop[2]];
    head.faceVertexUvs[0][6] = [headBottom[0], headBottom[3], headBottom[1]];
    head.faceVertexUvs[0][7] = [headBottom[3], headBottom[2], headBottom[1]];
    head.faceVertexUvs[0][8] = [headFront[3], headFront[0], headFront[2]];
    head.faceVertexUvs[0][9] = [headFront[0], headFront[1], headFront[2]];
    head.faceVertexUvs[0][10] = [headBack[3], headBack[0], headBack[2]];
    head.faceVertexUvs[0][11] = [headBack[0], headBack[1], headBack[2]];
    var cube = new THREE.Mesh(head, material);
    cube.position.y = 28
    cube.castShadow = true;
    scene.add(cube);

    // Body Parts
    var bodyTop = [
        new THREE.Vector2(0.3125, 0.6875),
        new THREE.Vector2(0.4375, 0.6875),
        new THREE.Vector2(0.4375, 0.75),
        new THREE.Vector2(0.3125, 0.75)
    ];
    var bodyBottom = [
        new THREE.Vector2(0.4375, 0.6875),
        new THREE.Vector2(0.5625, 0.6875),
        new THREE.Vector2(0.5625, 0.75),
        new THREE.Vector2(0.4375, 0.75)
    ];
    var bodyLeft = [
        new THREE.Vector2(0.25, 0.5),
        new THREE.Vector2(0.3125, 0.5),
        new THREE.Vector2(0.3125, 0.6875),
        new THREE.Vector2(0.25, 0.6875)
    ];
    var bodyFront = [
        new THREE.Vector2(0.3125, 0.5),
        new THREE.Vector2(0.4375, 0.5),
        new THREE.Vector2(0.4375, 0.6875),
        new THREE.Vector2(0.3125, 0.6875)
    ];
    var bodyRight = [
        new THREE.Vector2(0.4375, 0.5),
        new THREE.Vector2(0.5, 0.5),
        new THREE.Vector2(0.5, 0.6875),
        new THREE.Vector2(0.4375, 0.6875)
    ];
    var bodyBack = [
        new THREE.Vector2(0.5, 0.5),
        new THREE.Vector2(0.625, 0.5),
        new THREE.Vector2(0.625, 0.6875),
        new THREE.Vector2(0.5, 0.6875)
    ];
    bodyBox = new THREE.BoxGeometry(8, 12, 4, 0, 0, 0);
    bodyBox.faceVertexUvs[0] = [];
    bodyBox.faceVertexUvs[0][0] = [bodyRight[3], bodyRight[0], bodyRight[2]];
    bodyBox.faceVertexUvs[0][1] = [bodyRight[0], bodyRight[1], bodyRight[2]];
    bodyBox.faceVertexUvs[0][2] = [bodyLeft[3], bodyLeft[0], bodyLeft[2]];
    bodyBox.faceVertexUvs[0][3] = [bodyLeft[0], bodyLeft[1], bodyLeft[2]];
    bodyBox.faceVertexUvs[0][4] = [bodyTop[3], bodyTop[0], bodyTop[2]];
    bodyBox.faceVertexUvs[0][5] = [bodyTop[0], bodyTop[1], bodyTop[2]];
    bodyBox.faceVertexUvs[0][6] = [bodyBottom[0], bodyBottom[3], bodyBottom[1]];
    bodyBox.faceVertexUvs[0][7] = [bodyBottom[3], bodyBottom[2], bodyBottom[1]];
    bodyBox.faceVertexUvs[0][8] = [bodyFront[3], bodyFront[0], bodyFront[2]];
    bodyBox.faceVertexUvs[0][9] = [bodyFront[0], bodyFront[1], bodyFront[2]];
    bodyBox.faceVertexUvs[0][10] = [bodyBack[3], bodyBack[0], bodyBack[2]];
    bodyBox.faceVertexUvs[0][11] = [bodyBack[0], bodyBack[1], bodyBack[2]];
    bodyMesh = new THREE.Mesh(bodyBox, material);
    bodyMesh.name = "body";
    bodyMesh.position.y = 18;
    bodyMesh.castShadow = true;
    scene.add(bodyMesh);

    // Right Arm Parts
    var rightArmTop = [
        new THREE.Vector2(0.6875, 0.6875),
        new THREE.Vector2(0.75, 0.6875),
        new THREE.Vector2(0.75, 0.75),
        new THREE.Vector2(0.6875, 0.75),
    ];
    var rightArmBottom = [
        new THREE.Vector2(0.75, 0.6875),
        new THREE.Vector2(0.8125, 0.6875),
        new THREE.Vector2(0.8125, 0.75),
        new THREE.Vector2(0.75, 0.75)
    ];
    var rightArmLeft = [
        new THREE.Vector2(0.625, 0.5),
        new THREE.Vector2(0.6875, 0.5),
        new THREE.Vector2(0.6875, 0.6875),
        new THREE.Vector2(0.625, 0.6875)
    ];
    var rightArmFront = [
        new THREE.Vector2(0.6875, 0.5),
        new THREE.Vector2(0.75, 0.5),
        new THREE.Vector2(0.75, 0.6875),
        new THREE.Vector2(0.6875, 0.6875)
    ];
    var rightArmRight = [
        new THREE.Vector2(0.75, 0.5),
        new THREE.Vector2(0.8125, 0.5),
        new THREE.Vector2(0.8125, 0.6875),
        new THREE.Vector2(0.75, 0.6875)
    ];
    var rightArmBack = [
        new THREE.Vector2(0.8125, 0.5),
        new THREE.Vector2(0.875, 0.5),
        new THREE.Vector2(0.875, 0.6875),
        new THREE.Vector2(0.8125, 0.6875)
    ];
    rightArmBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0);
    rightArmBox.faceVertexUvs[0] = [];
    rightArmBox.faceVertexUvs[0][0] = [rightArmRight[3], rightArmRight[0], rightArmRight[2]];
    rightArmBox.faceVertexUvs[0][1] = [rightArmRight[0], rightArmRight[1], rightArmRight[2]];
    rightArmBox.faceVertexUvs[0][2] = [rightArmLeft[3], rightArmLeft[0], rightArmLeft[2]];
    rightArmBox.faceVertexUvs[0][3] = [rightArmLeft[0], rightArmLeft[1], rightArmLeft[2]];
    rightArmBox.faceVertexUvs[0][4] = [rightArmTop[3], rightArmTop[0], rightArmTop[2]];
    rightArmBox.faceVertexUvs[0][5] = [rightArmTop[0], rightArmTop[1], rightArmTop[2]];
    rightArmBox.faceVertexUvs[0][6] = [rightArmBottom[0], rightArmBottom[3], rightArmBottom[1]];
    rightArmBox.faceVertexUvs[0][7] = [rightArmBottom[3], rightArmBottom[2], rightArmBottom[1]];
    rightArmBox.faceVertexUvs[0][8] = [rightArmFront[3], rightArmFront[0], rightArmFront[2]];
    rightArmBox.faceVertexUvs[0][9] = [rightArmFront[0], rightArmFront[1], rightArmFront[2]];
    rightArmBox.faceVertexUvs[0][10] = [rightArmBack[3], rightArmBack[0], rightArmBack[2]];
    rightArmBox.faceVertexUvs[0][11] = [rightArmBack[0], rightArmBack[1], rightArmBack[2]];
    rightArmMesh = new THREE.Mesh(rightArmBox, material);
    rightArmMesh.name = "rightArm";
    rightArmMesh.position.y = 18;
    rightArmMesh.position.x = -6;
    rightArmMesh.castShadow = true;
    scene.add(rightArmMesh);

    // Left Arm Parts
    var leftArmTop = [
        new THREE.Vector2(0.5625, 0.1875),
        new THREE.Vector2(0.625, 0.1875),
        new THREE.Vector2(0.625, 0.25),
        new THREE.Vector2(0.5625, 0.25),
    ];
    var leftArmBottom = [
        new THREE.Vector2(0.625, 0.1875),
        new THREE.Vector2(0.6875, 0.1875),
        new THREE.Vector2(0.6875, 0.25),
        new THREE.Vector2(0.625, 0.25)
    ];
    var leftArmLeft = [
        new THREE.Vector2(0.5, 0),
        new THREE.Vector2(0.5625, 0),
        new THREE.Vector2(0.5625, 0.1875),
        new THREE.Vector2(0.5, 0.1875)
    ];
    var leftArmFront = [
        new THREE.Vector2(0.5625, 0),
        new THREE.Vector2(0.625, 0),
        new THREE.Vector2(0.625, 0.1875),
        new THREE.Vector2(0.5625, 0.1875)
    ];
    var leftArmRight = [
        new THREE.Vector2(0.625, 0),
        new THREE.Vector2(0.6875, 0),
        new THREE.Vector2(0.6875, 0.1875),
        new THREE.Vector2(0.625, 0.1875)
    ];
    var leftArmBack = [
        new THREE.Vector2(0.6875, 0),
        new THREE.Vector2(0.75, 0),
        new THREE.Vector2(0.75, 0.1875),
        new THREE.Vector2(0.6875, 0.1875)
    ];
    leftArmBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0);
    leftArmBox.faceVertexUvs[0] = [];
    leftArmBox.faceVertexUvs[0][0] = [leftArmRight[3], leftArmRight[0], leftArmRight[2]];
    leftArmBox.faceVertexUvs[0][1] = [leftArmRight[0], leftArmRight[1], leftArmRight[2]];
    leftArmBox.faceVertexUvs[0][2] = [leftArmLeft[3], leftArmLeft[0], leftArmLeft[2]];
    leftArmBox.faceVertexUvs[0][3] = [leftArmLeft[0], leftArmLeft[1], leftArmLeft[2]];
    leftArmBox.faceVertexUvs[0][4] = [leftArmTop[3], leftArmTop[0], leftArmTop[2]];
    leftArmBox.faceVertexUvs[0][5] = [leftArmTop[0], leftArmTop[1], leftArmTop[2]];
    leftArmBox.faceVertexUvs[0][6] = [leftArmBottom[0], leftArmBottom[3], leftArmBottom[1]];
    leftArmBox.faceVertexUvs[0][7] = [leftArmBottom[3], leftArmBottom[2], leftArmBottom[1]];
    leftArmBox.faceVertexUvs[0][8] = [leftArmFront[3], leftArmFront[0], leftArmFront[2]];
    leftArmBox.faceVertexUvs[0][9] = [leftArmFront[0], leftArmFront[1], leftArmFront[2]];
    leftArmBox.faceVertexUvs[0][10] = [leftArmBack[3], leftArmBack[0], leftArmBack[2]];
    leftArmBox.faceVertexUvs[0][11] = [leftArmBack[0], leftArmBack[1], leftArmBack[2]];
    leftArmMesh = new THREE.Mesh(leftArmBox, material);
    leftArmMesh.name = "leftArm";
    leftArmMesh.position.y = 18;
    leftArmMesh.position.x = 6;
    leftArmMesh.castShadow = true;
    scene.add(leftArmMesh);

    // Right Leg Parts
    var rightLegTop = [
        new THREE.Vector2(0.0625, 0.6875),
        new THREE.Vector2(0.125, 0.6875),
        new THREE.Vector2(0.125, 0.75),
        new THREE.Vector2(0.0625, 0.75),
    ];
    var rightLegBottom = [
        new THREE.Vector2(0.125, 0.6875),
        new THREE.Vector2(0.1875, 0.6875),
        new THREE.Vector2(0.1875, 0.75),
        new THREE.Vector2(0.125, 0.75)
    ];
    var rightLegLeft = [
        new THREE.Vector2(0, 0.5),
        new THREE.Vector2(0.0625, 0.5),
        new THREE.Vector2(0.0625, 0.6875),
        new THREE.Vector2(0, 0.6875)
    ];
    var rightLegFront = [
        new THREE.Vector2(0.0625, 0.5),
        new THREE.Vector2(0.125, 0.5),
        new THREE.Vector2(0.125, 0.6875),
        new THREE.Vector2(0.0625, 0.6875)
    ];
    var rightLegRight = [
        new THREE.Vector2(0.125, 0.5),
        new THREE.Vector2(0.1875, 0.5),
        new THREE.Vector2(0.1875, 0.6875),
        new THREE.Vector2(0.125, 0.6875)
    ];
    var rightLegBack = [
        new THREE.Vector2(0.1875, 0.5),
        new THREE.Vector2(0.25, 0.5),
        new THREE.Vector2(0.25, 0.6875),
        new THREE.Vector2(0.1875, 0.6875)
    ];
    rightLegBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0);
    rightLegBox.faceVertexUvs[0] = [];
    rightLegBox.faceVertexUvs[0][0] = [rightLegRight[3], rightLegRight[0], rightLegRight[2]];
    rightLegBox.faceVertexUvs[0][1] = [rightLegRight[0], rightLegRight[1], rightLegRight[2]];
    rightLegBox.faceVertexUvs[0][2] = [rightLegLeft[3], rightLegLeft[0], rightLegLeft[2]];
    rightLegBox.faceVertexUvs[0][3] = [rightLegLeft[0], rightLegLeft[1], rightLegLeft[2]];
    rightLegBox.faceVertexUvs[0][4] = [rightLegTop[3], rightLegTop[0], rightLegTop[2]];
    rightLegBox.faceVertexUvs[0][5] = [rightLegTop[0], rightLegTop[1], rightLegTop[2]];
    rightLegBox.faceVertexUvs[0][6] = [rightLegBottom[0], rightLegBottom[3], rightLegBottom[1]];
    rightLegBox.faceVertexUvs[0][7] = [rightLegBottom[3], rightLegBottom[2], rightLegBottom[1]];
    rightLegBox.faceVertexUvs[0][8] = [rightLegFront[3], rightLegFront[0], rightLegFront[2]];
    rightLegBox.faceVertexUvs[0][9] = [rightLegFront[0], rightLegFront[1], rightLegFront[2]];
    rightLegBox.faceVertexUvs[0][10] = [rightLegBack[3], rightLegBack[0], rightLegBack[2]];
    rightLegBox.faceVertexUvs[0][11] = [rightLegBack[0], rightLegBack[1], rightLegBack[2]];
    rightLegMesh = new THREE.Mesh(rightLegBox, material);
    rightLegMesh.name = "rightLeg"
    rightLegMesh.position.y = 6;
    rightLegMesh.position.x = -2;
    rightLegMesh.castShadow = true;
    scene.add(rightLegMesh);

    // Left Leg Parts
    var leftLegTop = [
        new THREE.Vector2(0.3125, 0.1875),
        new THREE.Vector2(0.375, 0.1875),
        new THREE.Vector2(0.375, 0.25),
        new THREE.Vector2(0.3125, 0.25),
    ];
    var leftLegBottom = [
        new THREE.Vector2(0.375, 0.1875),
        new THREE.Vector2(0.4375, 0.1875),
        new THREE.Vector2(0.4375, 0.25),
        new THREE.Vector2(0.375, 0.25)
    ];
    var leftLegLeft = [
        new THREE.Vector2(0.25, 0),
        new THREE.Vector2(0.3125, 0),
        new THREE.Vector2(0.3125, 0.1875),
        new THREE.Vector2(0.25, 0.1875)
    ];
    var leftLegFront = [
        new THREE.Vector2(0.3125, 0),
        new THREE.Vector2(0.375, 0),
        new THREE.Vector2(0.375, 0.1875),
        new THREE.Vector2(0.3125, 0.1875)
    ];
    var leftLegRight = [
        new THREE.Vector2(0.375, 0),
        new THREE.Vector2(0.4375, 0),
        new THREE.Vector2(0.4375, 0.1875),
        new THREE.Vector2(0.375, 0.1875)
    ];
    var leftLegBack = [
        new THREE.Vector2(0.4375, 0),
        new THREE.Vector2(0.5, 0),
        new THREE.Vector2(0.5, 0.1875),
        new THREE.Vector2(0.4375, 0.1875)
    ];
    leftLegBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0);
    leftLegBox.faceVertexUvs[0] = [];
    leftLegBox.faceVertexUvs[0][0] = [leftLegRight[3], leftLegRight[0], leftLegRight[2]];
    leftLegBox.faceVertexUvs[0][1] = [leftLegRight[0], leftLegRight[1], leftLegRight[2]];
    leftLegBox.faceVertexUvs[0][2] = [leftLegLeft[3], leftLegLeft[0], leftLegLeft[2]];
    leftLegBox.faceVertexUvs[0][3] = [leftLegLeft[0], leftLegLeft[1], leftLegLeft[2]];
    leftLegBox.faceVertexUvs[0][4] = [leftLegTop[3], leftLegTop[0], leftLegTop[2]];
    leftLegBox.faceVertexUvs[0][5] = [leftLegTop[0], leftLegTop[1], leftLegTop[2]];
    leftLegBox.faceVertexUvs[0][6] = [leftLegBottom[0], leftLegBottom[3], leftLegBottom[1]];
    leftLegBox.faceVertexUvs[0][7] = [leftLegBottom[3], leftLegBottom[2], leftLegBottom[1]];
    leftLegBox.faceVertexUvs[0][8] = [leftLegFront[3], leftLegFront[0], leftLegFront[2]];
    leftLegBox.faceVertexUvs[0][9] = [leftLegFront[0], leftLegFront[1], leftLegFront[2]];
    leftLegBox.faceVertexUvs[0][10] = [leftLegBack[3], leftLegBack[0], leftLegBack[2]];
    leftLegBox.faceVertexUvs[0][11] = [leftLegBack[0], leftLegBack[1], leftLegBack[2]];
    leftLegMesh = new THREE.Mesh(leftLegBox, material);
    leftLegMesh.name = "leftLeg";
    leftLegMesh.position.y = 6;
    leftLegMesh.position.x = 2;
    leftLegMesh.castShadow = true;
    scene.add(leftLegMesh);

    // Head Overlay Parts
    var head2Top = [
        new THREE.Vector2(0.625, 0.875),
        new THREE.Vector2(0.75, 0.875),
        new THREE.Vector2(0.75, 1),
        new THREE.Vector2(0.625, 1)
    ];
    var head2Bottom = [
        new THREE.Vector2(0.75, 0.875),
        new THREE.Vector2(0.875, 0.875),
        new THREE.Vector2(0.875, 1),
        new THREE.Vector2(0.75, 1)
    ];
    var head2Left = [
        new THREE.Vector2(0.5, 0.75),
        new THREE.Vector2(0.625, 0.75),
        new THREE.Vector2(0.625, 0.875),
        new THREE.Vector2(0.5, 0.875)
    ];
    var head2Front = [
        new THREE.Vector2(0.625, 0.75),
        new THREE.Vector2(0.75, 0.75),
        new THREE.Vector2(0.75, 0.875),
        new THREE.Vector2(0.625, 0.875)
    ];
    var head2Right = [
        new THREE.Vector2(0.75, 0.75),
        new THREE.Vector2(0.875, 0.75),
        new THREE.Vector2(0.875, 0.875),
        new THREE.Vector2(0.75, 0.875)
    ];
    var head2Back = [
        new THREE.Vector2(0.875, 0.75),
        new THREE.Vector2(1, 0.75),
        new THREE.Vector2(1, 0.875),
        new THREE.Vector2(0.875, 0.875)
    ];
    head2Box = new THREE.BoxGeometry(9, 9, 9, 0, 0, 0);
    head2Box.faceVertexUvs[0] = [];
    head2Box.faceVertexUvs[0][0] = [head2Right[3], head2Right[0], head2Right[2]];
    head2Box.faceVertexUvs[0][1] = [head2Right[0], head2Right[1], head2Right[2]];
    head2Box.faceVertexUvs[0][2] = [head2Left[3], head2Left[0], head2Left[2]];
    head2Box.faceVertexUvs[0][3] = [head2Left[0], head2Left[1], head2Left[2]];
    head2Box.faceVertexUvs[0][4] = [head2Top[3], head2Top[0], head2Top[2]];
    head2Box.faceVertexUvs[0][5] = [head2Top[0], head2Top[1], head2Top[2]];
    head2Box.faceVertexUvs[0][6] = [head2Bottom[0], head2Bottom[3], head2Bottom[1]];
    head2Box.faceVertexUvs[0][7] = [head2Bottom[3], head2Bottom[2], head2Bottom[1]];
    head2Box.faceVertexUvs[0][8] = [head2Front[3], head2Front[0], head2Front[2]];
    head2Box.faceVertexUvs[0][9] = [head2Front[0], head2Front[1], head2Front[2]];
    head2Box.faceVertexUvs[0][10] = [head2Back[3], head2Back[0], head2Back[2]];
    head2Box.faceVertexUvs[0][11] = [head2Back[0], head2Back[1], head2Back[2]];
    head2Mesh = new THREE.Mesh(head2Box, material);
    head2Mesh.position.y = 28;
    head2Mesh.name = "head2"
    head2Mesh.castShadow = true;
    scene.add(head2Mesh);

    // Body Overlay Parts
    var body2Top = [
        new THREE.Vector2(0.3125, 0.4375),
        new THREE.Vector2(0.4375, 0.4375),
        new THREE.Vector2(0.4375, 0.5),
        new THREE.Vector2(0.3125, 0.5)
    ];
    var body2Bottom = [
        new THREE.Vector2(0.4375, 0.4375),
        new THREE.Vector2(0.5625, 0.4375),
        new THREE.Vector2(0.5625, 0.5),
        new THREE.Vector2(0.4375, 0.5)
    ];
    var body2Left = [
        new THREE.Vector2(0.25, 0.25),
        new THREE.Vector2(0.3125, 0.25),
        new THREE.Vector2(0.3125, 0.4375),
        new THREE.Vector2(0.25, 0.4375)
    ];
    var body2Front = [
        new THREE.Vector2(0.3125, 0.25),
        new THREE.Vector2(0.4375, 0.25),
        new THREE.Vector2(0.4375, 0.4375),
        new THREE.Vector2(0.3125, 0.4375)
    ];
    var body2Right = [
        new THREE.Vector2(0.4375, 0.25),
        new THREE.Vector2(0.5, 0.25),
        new THREE.Vector2(0.5, 0.4375),
        new THREE.Vector2(0.4375, 0.4375)
    ];
    var body2Back = [
        new THREE.Vector2(0.5, 0.25),
        new THREE.Vector2(0.625, 0.25),
        new THREE.Vector2(0.625, 0.4375),
        new THREE.Vector2(0.5, 0.4375)
    ];
    body2Box = new THREE.BoxGeometry(9, 13.5, 4.5, 0, 0, 0);
    body2Box.faceVertexUvs[0] = [];
    body2Box.faceVertexUvs[0][0] = [body2Right[3], body2Right[0], body2Right[2]];
    body2Box.faceVertexUvs[0][1] = [body2Right[0], body2Right[1], body2Right[2]];
    body2Box.faceVertexUvs[0][2] = [body2Left[3], body2Left[0], body2Left[2]];
    body2Box.faceVertexUvs[0][3] = [body2Left[0], body2Left[1], body2Left[2]];
    body2Box.faceVertexUvs[0][4] = [body2Top[3], body2Top[0], body2Top[2]];
    body2Box.faceVertexUvs[0][5] = [body2Top[0], body2Top[1], body2Top[2]];
    body2Box.faceVertexUvs[0][6] = [body2Bottom[0], body2Bottom[3], body2Bottom[1]];
    body2Box.faceVertexUvs[0][7] = [body2Bottom[3], body2Bottom[2], body2Bottom[1]];
    body2Box.faceVertexUvs[0][8] = [body2Front[3], body2Front[0], body2Front[2]];
    body2Box.faceVertexUvs[0][9] = [body2Front[0], body2Front[1], body2Front[2]];
    body2Box.faceVertexUvs[0][10] = [body2Back[3], body2Back[0], body2Back[2]];
    body2Box.faceVertexUvs[0][11] = [body2Back[0], body2Back[1], body2Back[2]];
    body2Mesh = new THREE.Mesh(body2Box, material);
    body2Mesh.name = "body2";
    body2Mesh.position.y = 18;
    body2Mesh.castShadow = true;
    scene.add(body2Mesh);

    // Right Arm Overlay Parts
    var rightArm2Top = [
        new THREE.Vector2(0.6875, 0.4375),
        new THREE.Vector2(0.75, 0.4375),
        new THREE.Vector2(0.75, 0.5),
        new THREE.Vector2(0.6875, 0.5),
    ];
    var rightArm2Bottom = [
        new THREE.Vector2(0.75, 0.4375),
        new THREE.Vector2(0.8125, 0.4375),
        new THREE.Vector2(0.8125, 0.5),
        new THREE.Vector2(0.75, 0.5)
    ];
    var rightArm2Left = [
        new THREE.Vector2(0.625, 0.25),
        new THREE.Vector2(0.6875, 0.25),
        new THREE.Vector2(0.6875, 0.4375),
        new THREE.Vector2(0.625, 0.4375)
    ];
    var rightArm2Front = [
        new THREE.Vector2(0.6875, 0.25),
        new THREE.Vector2(0.75, 0.25),
        new THREE.Vector2(0.75, 0.4375),
        new THREE.Vector2(0.6875, 0.4375)
    ];
    var rightArm2Right = [
        new THREE.Vector2(0.75, 0.25),
        new THREE.Vector2(0.8125, 0.25),
        new THREE.Vector2(0.8125, 0.4375),
        new THREE.Vector2(0.75, 0.4375)
    ];
    var rightArm2Back = [
        new THREE.Vector2(0.8125, 0.25),
        new THREE.Vector2(0.875, 0.25),
        new THREE.Vector2(0.875, 0.4375),
        new THREE.Vector2(0.8125, 0.4375)
    ];
    rightArm2Box = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
    rightArm2Box.faceVertexUvs[0] = [];
    rightArm2Box.faceVertexUvs[0][0] = [rightArm2Right[3], rightArm2Right[0], rightArm2Right[2]];
    rightArm2Box.faceVertexUvs[0][1] = [rightArm2Right[0], rightArm2Right[1], rightArm2Right[2]];
    rightArm2Box.faceVertexUvs[0][2] = [rightArm2Left[3], rightArm2Left[0], rightArm2Left[2]];
    rightArm2Box.faceVertexUvs[0][3] = [rightArm2Left[0], rightArm2Left[1], rightArm2Left[2]];
    rightArm2Box.faceVertexUvs[0][4] = [rightArm2Top[3], rightArm2Top[0], rightArm2Top[2]];
    rightArm2Box.faceVertexUvs[0][5] = [rightArm2Top[0], rightArm2Top[1], rightArm2Top[2]];
    rightArm2Box.faceVertexUvs[0][6] = [rightArm2Bottom[0], rightArm2Bottom[3], rightArm2Bottom[1]];
    rightArm2Box.faceVertexUvs[0][7] = [rightArm2Bottom[3], rightArm2Bottom[2], rightArm2Bottom[1]];
    rightArm2Box.faceVertexUvs[0][8] = [rightArm2Front[3], rightArm2Front[0], rightArm2Front[2]];
    rightArm2Box.faceVertexUvs[0][9] = [rightArm2Front[0], rightArm2Front[1], rightArm2Front[2]];
    rightArm2Box.faceVertexUvs[0][10] = [rightArm2Back[3], rightArm2Back[0], rightArm2Back[2]];
    rightArm2Box.faceVertexUvs[0][11] = [rightArm2Back[0], rightArm2Back[1], rightArm2Back[2]];
    rightArm2Mesh = new THREE.Mesh(rightArm2Box, material);
    rightArm2Mesh.name = "rightArm2";
    rightArm2Mesh.position.y = 18;
    rightArm2Mesh.position.x = -6;
    rightArm2Mesh.castShadow = true;
    scene.add(rightArm2Mesh);

    // Left Arm Overlay Parts
    var leftArm2Top = [
        new THREE.Vector2(0.8125, 0.1875),
        new THREE.Vector2(0.875, 0.1875),
        new THREE.Vector2(0.875, 0.25),
        new THREE.Vector2(0.8125, 0.25),
    ];
    var leftArm2Bottom = [
        new THREE.Vector2(0.875, 0.1875),
        new THREE.Vector2(0.9375, 0.1875),
        new THREE.Vector2(0.9375, 0.25),
        new THREE.Vector2(0.875, 0.25)
    ];
    var leftArm2Left = [
        new THREE.Vector2(0.75, 0),
        new THREE.Vector2(0.8125, 0),
        new THREE.Vector2(0.8125, 0.1875),
        new THREE.Vector2(0.75, 0.1875)
    ];
    var leftArm2Front = [
        new THREE.Vector2(0.8125, 0),
        new THREE.Vector2(0.875, 0),
        new THREE.Vector2(0.875, 0.1875),
        new THREE.Vector2(0.8125, 0.1875)
    ];
    var leftArm2Right = [
        new THREE.Vector2(0.875, 0),
        new THREE.Vector2(0.9375, 0),
        new THREE.Vector2(0.9375, 0.1875),
        new THREE.Vector2(0.875, 0.1875)
    ];
    var leftArm2Back = [
        new THREE.Vector2(0.9375, 0),
        new THREE.Vector2(1, 0),
        new THREE.Vector2(1, 0.1875),
        new THREE.Vector2(0.9375, 0.1875)
    ];
    leftArm2Box = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
    leftArm2Box.faceVertexUvs[0] = [];
    leftArm2Box.faceVertexUvs[0][0] = [leftArm2Right[3], leftArm2Right[0], leftArm2Right[2]];
    leftArm2Box.faceVertexUvs[0][1] = [leftArm2Right[0], leftArm2Right[1], leftArm2Right[2]];
    leftArm2Box.faceVertexUvs[0][2] = [leftArm2Left[3], leftArm2Left[0], leftArm2Left[2]];
    leftArm2Box.faceVertexUvs[0][3] = [leftArm2Left[0], leftArm2Left[1], leftArm2Left[2]];
    leftArm2Box.faceVertexUvs[0][4] = [leftArm2Top[3], leftArm2Top[0], leftArm2Top[2]];
    leftArm2Box.faceVertexUvs[0][5] = [leftArm2Top[0], leftArm2Top[1], leftArm2Top[2]];
    leftArm2Box.faceVertexUvs[0][6] = [leftArm2Bottom[0], leftArm2Bottom[3], leftArm2Bottom[1]];
    leftArm2Box.faceVertexUvs[0][7] = [leftArm2Bottom[3], leftArm2Bottom[2], leftArm2Bottom[1]];
    leftArm2Box.faceVertexUvs[0][8] = [leftArm2Front[3], leftArm2Front[0], leftArm2Front[2]];
    leftArm2Box.faceVertexUvs[0][9] = [leftArm2Front[0], leftArm2Front[1], leftArm2Front[2]];
    leftArm2Box.faceVertexUvs[0][10] = [leftArm2Back[3], leftArm2Back[0], leftArm2Back[2]];
    leftArm2Box.faceVertexUvs[0][11] = [leftArm2Back[0], leftArm2Back[1], leftArm2Back[2]];
    leftArm2Mesh = new THREE.Mesh(leftArm2Box, material);
    leftArm2Mesh.name = "leftArm2";
    leftArm2Mesh.position.y = 18;
    leftArm2Mesh.position.x = 6;
    leftArm2Mesh.castShadow = true;
    scene.add(leftArm2Mesh);

    // Right Leg Overlay Parts
    var rightLeg2Top = [
        new THREE.Vector2(0.0625, 0.4375),
        new THREE.Vector2(0.125, 0.4375),
        new THREE.Vector2(0.125, 0.5),
        new THREE.Vector2(0.0625, 0.5),
    ];
    var rightLeg2Bottom = [
        new THREE.Vector2(0.125, 0.4375),
        new THREE.Vector2(0.1875, 0.4375),
        new THREE.Vector2(0.1875, 0.5),
        new THREE.Vector2(0.125, 0.5)
    ];
    var rightLeg2Left = [
        new THREE.Vector2(0, 0.25),
        new THREE.Vector2(0.0625, 0.25),
        new THREE.Vector2(0.0625, 0.4375),
        new THREE.Vector2(0, 0.4375)
    ];
    var rightLeg2Front = [
        new THREE.Vector2(0.0625, 0.25),
        new THREE.Vector2(0.125, 0.25),
        new THREE.Vector2(0.125, 0.4375),
        new THREE.Vector2(0.0625, 0.4375)
    ];
    var rightLeg2Right = [
        new THREE.Vector2(0.125, 0.25),
        new THREE.Vector2(0.1875, 0.25),
        new THREE.Vector2(0.1875, 0.4375),
        new THREE.Vector2(0.125, 0.4375)
    ];
    var rightLeg2Back = [
        new THREE.Vector2(0.1875, 0.25),
        new THREE.Vector2(0.25, 0.25),
        new THREE.Vector2(0.25, 0.4375),
        new THREE.Vector2(0.1875, 0.4375)
    ];
    rightLeg2Box = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
    rightLeg2Box.faceVertexUvs[0] = [];
    rightLeg2Box.faceVertexUvs[0][0] = [rightLeg2Right[3], rightLeg2Right[0], rightLeg2Right[2]];
    rightLeg2Box.faceVertexUvs[0][1] = [rightLeg2Right[0], rightLeg2Right[1], rightLeg2Right[2]];
    rightLeg2Box.faceVertexUvs[0][2] = [rightLeg2Left[3], rightLeg2Left[0], rightLeg2Left[2]];
    rightLeg2Box.faceVertexUvs[0][3] = [rightLeg2Left[0], rightLeg2Left[1], rightLeg2Left[2]];
    rightLeg2Box.faceVertexUvs[0][4] = [rightLeg2Top[3], rightLeg2Top[0], rightLeg2Top[2]];
    rightLeg2Box.faceVertexUvs[0][5] = [rightLeg2Top[0], rightLeg2Top[1], rightLeg2Top[2]];
    rightLeg2Box.faceVertexUvs[0][6] = [rightLeg2Bottom[0], rightLeg2Bottom[3], rightLeg2Bottom[1]];
    rightLeg2Box.faceVertexUvs[0][7] = [rightLeg2Bottom[3], rightLeg2Bottom[2], rightLeg2Bottom[1]];
    rightLeg2Box.faceVertexUvs[0][8] = [rightLeg2Front[3], rightLeg2Front[0], rightLeg2Front[2]];
    rightLeg2Box.faceVertexUvs[0][9] = [rightLeg2Front[0], rightLeg2Front[1], rightLeg2Front[2]];
    rightLeg2Box.faceVertexUvs[0][10] = [rightLeg2Back[3], rightLeg2Back[0], rightLeg2Back[2]];
    rightLeg2Box.faceVertexUvs[0][11] = [rightLeg2Back[0], rightLeg2Back[1], rightLeg2Back[2]];
    rightLeg2Mesh = new THREE.Mesh(rightLeg2Box, material);
    rightLeg2Mesh.name = "rightLeg2"
    rightLeg2Mesh.position.y = 6;
    rightLeg2Mesh.position.x = -2;
    rightLeg2Mesh.castShadow = true;
    scene.add(rightLeg2Mesh);

    // Left Leg Overlay Parts
    var leftLeg2Top = [
        new THREE.Vector2(0.0625, 0.1875),
        new THREE.Vector2(0.125, 0.1875),
        new THREE.Vector2(0.125, 0.25),
        new THREE.Vector2(0.0625, 0.25),
    ];
    var leftLeg2Bottom = [
        new THREE.Vector2(0.125, 0.1875),
        new THREE.Vector2(0.1875, 0.1875),
        new THREE.Vector2(0.1875, 0.25),
        new THREE.Vector2(0.125, 0.25)
    ];
    var leftLeg2Left = [
        new THREE.Vector2(0, 0),
        new THREE.Vector2(0.0625, 0),
        new THREE.Vector2(0.0625, 0.1875),
        new THREE.Vector2(0, 0.1875)
    ];
    var leftLeg2Front = [
        new THREE.Vector2(0.0625, 0),
        new THREE.Vector2(0.125, 0),
        new THREE.Vector2(0.125, 0.1875),
        new THREE.Vector2(0.0625, 0.1875)
    ];
    var leftLeg2Right = [
        new THREE.Vector2(0.125, 0),
        new THREE.Vector2(0.1875, 0),
        new THREE.Vector2(0.1875, 0.1875),
        new THREE.Vector2(0.125, 0.1875)
    ];
    var leftLeg2Back = [
        new THREE.Vector2(0.1875, 0),
        new THREE.Vector2(0.25, 0),
        new THREE.Vector2(0.25, 0.1875),
        new THREE.Vector2(0.1875, 0.1875)
    ];
    var leftLeg2Box = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
    leftLeg2Box.faceVertexUvs[0] = [];
    leftLeg2Box.faceVertexUvs[0][0] = [leftLeg2Right[3], leftLeg2Right[0], leftLeg2Right[2]];
    leftLeg2Box.faceVertexUvs[0][1] = [leftLeg2Right[0], leftLeg2Right[1], leftLeg2Right[2]];
    leftLeg2Box.faceVertexUvs[0][2] = [leftLeg2Left[3], leftLeg2Left[0], leftLeg2Left[2]];
    leftLeg2Box.faceVertexUvs[0][3] = [leftLeg2Left[0], leftLeg2Left[1], leftLeg2Left[2]];
    leftLeg2Box.faceVertexUvs[0][4] = [leftLeg2Top[3], leftLeg2Top[0], leftLeg2Top[2]];
    leftLeg2Box.faceVertexUvs[0][5] = [leftLeg2Top[0], leftLeg2Top[1], leftLeg2Top[2]];
    leftLeg2Box.faceVertexUvs[0][6] = [leftLeg2Bottom[0], leftLeg2Bottom[3], leftLeg2Bottom[1]];
    leftLeg2Box.faceVertexUvs[0][7] = [leftLeg2Bottom[3], leftLeg2Bottom[2], leftLeg2Bottom[1]];
    leftLeg2Box.faceVertexUvs[0][8] = [leftLeg2Front[3], leftLeg2Front[0], leftLeg2Front[2]];
    leftLeg2Box.faceVertexUvs[0][9] = [leftLeg2Front[0], leftLeg2Front[1], leftLeg2Front[2]];
    leftLeg2Box.faceVertexUvs[0][10] = [leftLeg2Back[3], leftLeg2Back[0], leftLeg2Back[2]];
    leftLeg2Box.faceVertexUvs[0][11] = [leftLeg2Back[0], leftLeg2Back[1], leftLeg2Back[2]];
    leftLeg2Mesh = new THREE.Mesh(leftLeg2Box, material);
    leftLeg2Mesh.name = "leftLeg2";
    leftLeg2Mesh.position.y = 6;
    leftLeg2Mesh.position.x = 2;
    leftLeg2Mesh.castShadow = true;
    scene.add(leftLeg2Mesh);


    //将渲染器输出添加到html元素中
    $("#skin").html("");
    $("#skin").append(randerer.domElement);
    randerer.render(scene, camera);

    function render() {
        randerer.render(scene, camera);
        // cube.rotateY(0.02);
        // cube.rotateX(0.01);
    }

    render();
    // controls = new THREE.OrbitControls(camera, randerer.domElement);
    setInterval(render, 16);
}
$(function () {
    $.get("/tnweb/user/getPlayerInfoHead", function (data) {
        if (data.webUserName == "" || data.webUserName == null) {
            $("#basicInfo").before("<img id=\"headImg\" src=\""+data.webUserHead+"\" style=\"height: 100px; width: 100px; border-radius: 50px\">");
        }
        if (data.webUserName != "" || data.webUserName != null) {
            if (data.isMe == 1) {
                $("#basicInfo").before("<img id=\"headImg\" src=\"" + data.webUserHead + "\" style=\"height: 100px; width: 100px; border-radius: 50px\" onclick=\"openUploadModal()\" title=\"点击头像更换\">");
            } else {
                $("#basicInfo").before("<img id=\"headImg\" src=\"" + data.webUserHead + "\" style=\"height: 100px; width: 100px; border-radius: 50px\">");
            }
        }
        $("#headImg").prop("src", data.webUserHead);
        $("#webUserId").text(data.webUserName);
        if (data.isMe == 0) {
            $("#head").append("<span href=\"#\" id=\"boundIdName\">"+data.boundMcName+"</span>")
        }
        if (data.isMe == 1) {
            if (data.isBound == 0) {
                $("#head").append("<a href=\"#\" id=\"boundIdName\" onclick=\"openModal()\">未绑定，点击绑定</a>");
            }
            if (data.isBound == 1) {
                $("#head").append("<span id=\"boundIdName\">"+data.boundMcName+"</span>&nbsp;&nbsp;&nbsp;");
                $("#head").append("<a href=\"#\" onclick=\"openDeBoundModal()\">取消绑定</a>");
            }
        }
        $("#head").append("<input id=\"isBound\" type=\"hidden\" value=\""+data.isBound+"\">")

        if (data.isBound == 1) {
            if (data.isMe == 1) {
                $("#webUserId").append("&nbsp;&nbsp;&nbsp;<button type=\"button\" class=\"btn btn-success\" onclick=\"openRewardModal()\">领取绑定奖励</button>")
            }
            $.get("/tnweb/user/getPlayerInfo", {
                "userId": data.boundMcName
            }, function (data1) {
                $("#onlineStatus").text(data1.onlineStatus);
                $("#playerHealth").text(data1.playerHealth);
                $("#playerHunger").text(data1.playerHunger);
                $("#playerLevel").text(data1.playerLevel);
                $("#playerExp").text(data1.playerExp);
                $("#playerExpToNextLevel").text(data1.playerExpToNextLevel);
                $("#playerPoints").text(data1.playerPoints);
                $("#playerEco").text(data1.playerEco);
                $("#playerVIP").text(data1.playerVIP);
                $("#PlayerVIPRest").text(data1.playerVIPRest);
                $("#playerSendMail").text(data1.playerSendMail);
                $("#playerReceivedMail").text(data1.playerReceivedMail);
                $("#isMarry").text(data1.isMarry);
                $("#marryLover").text(data1.marryLover);
                $("#playerRegTime").text(data1.playerRegTime);
                $("#playerLastLoginTime").text(data1.playerLastLoginTime);
                skinPath = data1.playerSkinPath;
                window.onload = init(skinPath);
            });
        } else {
            window.onload = init(skinPath);
        }
    });

});
function boundMc() {
    var mcId = $("#MCId").val();
    var pass = $("#MCPassword").val();
    var mcPassword = sha256_digest(pass);
    $("#boundConfirm").prop("disabled", "disabled")
    $.post("/tnweb/user/boundMc", {
        "mcId": mcId,
        "mcPassword": mcPassword
    }, function (data) {
        if (data.code == 0) {
            layer.msg(data.msg);
            return;
        }
        if (data.code == 1) {
            layer.msg(data.msg);
            setTimeout("flushThis()", 2000);
        }
    });
}

function flushThis() {
    window.location.href = "/tnweb/user/playerInfo";
}

function openModal() {
    layer.open({
        type: 1,//类型
        area: ['400px', '300px'],//定义宽和高
        title: '绑定游戏ID',//题目
        shadeClose: true,//点击遮罩层关闭
        offset: ['200px', '760px'],
        content: $("#boundMcModal")//打开的内容
    });
}

function openDeBoundModal() {
    layer.open({
        type: 1,//类型
        area: ['400px', '200px'],//定义宽和高
        title: '请输入密码确认取消绑定',//题目
        shadeClose: true,//点击遮罩层关闭
        offset: ['300px', '760px'],
        content: $("#deBoundModal")//打开的内容
    });
}

function deBoundMc() {
    $.get("/tnweb/user/unBoundMc", {
        "mcPassword": sha256_digest($("#deBondMCPassword").val())
    },function (data) {
        if (data.code == 0) {
            layer.msg(data.msg);
            return;
        }
        if (data.code == 1) {
            layer.msg(data.msg);
            setTimeout("flushThis()", 2000);
        }
    });
}

function openRewardModal() {
    layer.open({
        type: 1,//类型
        area: ['400px', '300px'],//定义宽和高
        title: '绑定奖励',//题目
        shadeClose: true,//点击遮罩层关闭
        offset: ['300px', '760px'],
        content: $("#BoundRewardModal")//打开的内容
    });
}

function openUploadModal() {
    layer.open({
        type: 1,//类型
        area: ['400px', '200px'],//定义宽和高
        title: '上传头像',//题目
        shadeClose: true,//点击遮罩层关闭
        offset: ['200px', '760px'],
        content: $("#changeImgModal")//打开的内容
    });
}

function getBoundRewards() {
    $.get("/tnweb/user/boundRewards", function (data) {
        if (data.type == "白嫖怪") {
            layer.msg(data.descriptions, {'icon': 2});
        } else {
            $("#boundTitle").text("奖励领取成功");
            $("#BondRewardDescription1").text(data.coin + " 银币");
            $("#BondRewardDescription2").text(data.point + " 金币");
            $("#BondRewardDescription6").text("踩一下主城的刷新邮件,按M即可领取");
            $("#BondRewardDescription6").prop("style", "width: 290px;color: red");
            $("#BoundRewardConfirm").prop("onclick", "");
            $("#rewardButton").prop("hidden", "hidden");
        }
    });
}

$("#uploadConfirm").click(function () {
    var uploadHead = $("#uploadHead").val();
    if (uploadHead == null || uploadHead == "") {
        layer.alert("请确认选择图片后再上传", {'icon':2});
        return;
    }
    $.ajaxFileUpload({
        url: '/tnweb/user/uploadHead', //用于文件上传的服务器端请求地址
        fileElementId: 'uploadHead', //文件上传域的ID
        dataType: 'json', //返回值类型 一般设置为json
        success: function (data) {
            //data:resultVo
            if (data.code == 0) {
                layer.alert(data.msg, {'icon': 2});
                return;
            }
            if (data.code == 1) {
                layer.msg(data.msg);
                setTimeout("flushThis()", 2000);
            }
        }
    });
    return false;
})





